# Define the correct MIME type for specific languages
AddType text/html .bn
AddType text/html .el
AddType text/html .nb
AddType text/html .pl
AddType text/html .es
AddType text/html .tr
AddType text/html .sr
AddType text/html .si
AddType text/html .pt
 
AddLanguage ar .ar
AddLanguage bg .bg
AddLanguage bn .bn
AddLanguage bn-in .bn_IN
AddLanguage ca .ca
AddLanguage cs .cs
AddLanguage da .da
AddLanguage de .de
AddLanguage en .en
AddLanguage es .es
AddLanguage fa .fa
AddLanguage fi .fi
AddLanguage fr .fr
AddLanguage fur .fur
AddLanguage gu .gu
AddLanguage he .he
AddLanguage hu .hu
AddLanguage id .id
AddLanguage it .it
AddLanguage ja .ja
AddLanguage km .km
AddLanguage ko .ko
AddLanguage ne .ne
AddLanguage pl .pl
AddLanguage pt .pt
AddLanguage pt-br .pt_BR
AddLanguage si .si
AddLanguage sk .sk
AddLanguage sv .sv
AddLanguage tr .tr
AddLanguage uk .uk
AddLanguage zh-cn .zh_Hans_CN

LanguagePriority en
ForceLanguagePriority Prefer Fallback

AddDefaultCharset utf-8

RewriteEngine on

RewriteCond %{QUERY_STRING} ^lang=(ar|bg|bn|bn_IN|ca|cs|da|de|en|es|fa|fi|fr|fur|gu|he|hu|id|it|ja|km|ko|ne|pl|pt|pt_BR|si|sk|sv|tr|uk|zh_Hans_CN)$
RewriteRule ^(?:/(?:ar|bg|bn|bn_IN|ca|cs|da|de|en|es|fa|fi|fr|fur|gu|he|hu|id|it|ja|km|ko|ne|pl|pt|pt_BR|si|sk|sv|tr|uk|zh_Hans_CN))?(/.*)$ /%1$1? [R=301]
AliasMatch ^(?:/(?:ar|bg|bn|bn_IN|ca|cs|da|de|en|es|fa|fi|fr|fur|gu|he|hu|id|it|ja|km|ko|ne|pl|pt|pt_BR|si|sk|sv|tr|uk|zh_Hans_CN))(/.*)?$ /srv/web/alt.fedoraproject.org$1

<Directory /srv/web/alt.fedoraproject.org>
  Options MultiViews

  SetEnvIf Request_URI ^/ar/ prefer-language=ar
  SetEnvIf Request_URI ^/bg/ prefer-language=bg
  SetEnvIf Request_URI ^/bn/ prefer-language=bn
  SetEnvIf Request_URI ^/bn_IN/ prefer-language=bn-in
  SetEnvIf Request_URI ^/ca/ prefer-language=ca
  SetEnvIf Request_URI ^/cs/ prefer-language=cs
  SetEnvIf Request_URI ^/da/ prefer-language=da
  SetEnvIf Request_URI ^/de/ prefer-language=de
  SetEnvIf Request_URI ^/en/ prefer-language=en
  SetEnvIf Request_URI ^/es/ prefer-language=es
  SetEnvIf Request_URI ^/fa/ prefer-language=fa
  SetEnvIf Request_URI ^/fi/ prefer-language=fi
  SetEnvIf Request_URI ^/fr/ prefer-language=fr
  SetEnvIf Request_URI ^/fur/ prefer-language=fur
  SetEnvIf Request_URI ^/gu/ prefer-language=gu
  SetEnvIf Request_URI ^/he/ prefer-language=he
  SetEnvIf Request_URI ^/hu/ prefer-language=hu
  SetEnvIf Request_URI ^/id/ prefer-language=id
  SetEnvIf Request_URI ^/it/ prefer-language=it
  SetEnvIf Request_URI ^/ja/ prefer-language=ja
  SetEnvIf Request_URI ^/km/ prefer-language=km
  SetEnvIf Request_URI ^/ko/ prefer-language=ko
  SetEnvIf Request_URI ^/ne/ prefer-language=ne
  SetEnvIf Request_URI ^/pl/ prefer-language=pl
  SetEnvIf Request_URI ^/pt/ prefer-language=pt
  SetEnvIf Request_URI ^/pt_BR/ prefer-language=pt-br
  SetEnvIf Request_URI ^/si/ prefer-language=si
  SetEnvIf Request_URI ^/sk/ prefer-language=sk
  SetEnvIf Request_URI ^/sv/ prefer-language=sv
  SetEnvIf Request_URI ^/tr/ prefer-language=tr
  SetEnvIf Request_URI ^/uk/ prefer-language=uk
  SetEnvIf Request_URI ^/zh_Hans_CN/ prefer-language=zh-cn
</Directory>
